<?php require_once '../util/verifyMenu.php';?>
<?php require_once '../util/verifyLogin.php';?>
<?php require_once '../util/header.php';?>
<body>
<div class="mycontent" align="center">
<img src="public/img/header.png" style="width: 1024px; margin: -6px;">
<?php require_once '../util/menu.php';?>
<div align="left">
&nbsp;&nbsp;&nbsp;ยอดซื้อ <b><?php echo $_SESSION['profit'];?></b> บาท&nbsp;&nbsp;&nbsp;
<input type="button" class="btn btn-info" value="ดูประวัติการซื้อ" style="margin-right: 20px;" onclick="javascript:location.href='../control/buydetailControl.php'">
<span style="float: right;">
สวัสดี คุณ <b><?php echo $_SESSION['name']." ".$_SESSION['lastname'];?></b>&nbsp;&nbsp;&nbsp;
<input type="button" class="btn" value="ออกจากระบบ" style="margin-right: 20px;" onclick="javascript:location.href='../util/logout.php'">
</span>
</div>
<h2>Confirm Order</h2>
<hr>
<form name="frm" action="../control/confirmControl.php" method="post">
<b>การเดินทาง : <?php echo $_SESSION['route'];?> </b><br>
<b>เวลารถออก : <?php echo $_SESSION['xtime'];?> </b><br>
<b>เวลารถถึง : <?php echo $_SESSION['ytime'];?> </b><br>
<b>ประเภท : <?php echo $_SESSION['type'];?> </b><br><br>
<?php 
	$data = $_SESSION['c_seat'];
	echo "<table class='table table-hover' style='width:50%;'>";
	echo "<th>ลำดับ</th><th>ที่นั่ง</th><th>ราคา/หน่วย</th>";
	$sum = 0;
	for ($i = 0; $i < count($data); $i++) {
		$sum += $_SESSION['price'];
		echo "<tr>";
		echo "<td>".($i+1)."</td>";
		echo "<td>".$data[$i]."</td>";
		echo "<td>".$_SESSION['price']."</td>";
		echo "</tr>";
	}
	echo "</table>";
	echo "<br><h3>ราคารวม ".number_format($sum)." ฿</h3>";
	$_SESSION['sum'] = $sum;
?>
<br>
<input type="button" class="btn btn-large" value="กลับ" onclick="location.href='chooseseat.php'">
<input type="submit" class="btn btn-large btn-primary" value="ยืนยัน">
</form>
<?php require_once '../util/footer.php';?>

</div>
</body>
